package cn.kami.dao.proxy;

import java.util.List;

import cn.kami.dao.IStockIn;
import cn.kami.dao.impl.StockInDAOImpl;
import cn.kami.dbc.DatabaseConnection;
import cn.kami.factory.DatabaseConnectionFactory;
import cn.kami.vo.StockIn;

public class StockInDAOProxy implements IStockIn {
	private DatabaseConnection dbc = null;
	private StockInDAOImpl dao = null;
	public StockInDAOProxy()throws Exception{
		this.dbc = DatabaseConnectionFactory.getOracleDatabaseConnection();
		this.dao = new StockInDAOImpl(this.dbc.getConnection());
	}
	@Override
	public boolean doCreate(StockIn si) throws Exception {
		// TODO Auto-generated method stub
		boolean flag = false;
		try{
			flag = this.dao.doCreate(si);
		}catch(Exception e){
			throw e;
		}finally{
			this.dbc.close();
		}
		return flag;
	}
	@Override
	public String getSiID() throws Exception {
		// TODO Auto-generated method stub
		String SiID = null;
		try{
			SiID = this.dao.getSiID();
		}catch(Exception e){
			throw e;
		}finally{
			this.dbc.close();
		}
		return SiID;
	}
	@Override
	public List<StockIn> findByName(String name) throws Exception {
		// TODO Auto-generated method stub
		List<StockIn> all = null;
		try{
			all = this.dao.findByName(name);
		}catch(Exception e){
			throw e;
		}finally{
			this.dbc.close();
		}
		return all;
	}

}
